package com.ruoyi.biz.report.letter.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.google.common.collect.Lists;
import com.ruoyi.biz.category.mapper.BizCategoryMapper;
import com.ruoyi.biz.category.service.IBizCategoryService;
import com.ruoyi.biz.letter.mapper.BizMayorHotlineMapper;
import com.ruoyi.biz.report.domain.BizReportConfig;
import com.ruoyi.biz.report.letter.vo.CategoryReportReq;
import com.ruoyi.biz.report.letter.vo.ReportCityCategoryResp;
import com.ruoyi.biz.report.letter.vo.ReportYearCategoryResp;
import com.ruoyi.biz.report.letter.vo.ReportYearCityResp;
import com.ruoyi.biz.report.mapper.BizReportConfigMapper;
import com.ruoyi.common.core.domain.TreeSelect;
import com.ruoyi.common.core.domain.entity.BizCategory;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.system.mapper.SysDeptMapper;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.Objects;

/**
 * @author Fei.Cong
 * @date 2024-08-26 17:20
 */
@Service
@RequiredArgsConstructor
public class HotlineReportService {

    private final BizMayorHotlineMapper bizMayorHotlineMapper;
    private final CategoryService categoryService;

    /**
     * 热线，地市  分类统计
     */
    public List<ReportCityCategoryResp> getReportGroupByCityAndCategory(CategoryReportReq reportReq) {
        List<ReportCityCategoryResp> hotlineReportResps = bizMayorHotlineMapper.selectReportGroupCityAndCategory(reportReq);
        return categoryService.getReportCityAndCategory(hotlineReportResps);
    }

    /**
     * 热线，月份  地市统计
     */
    public List<ReportYearCityResp> selectReportGroupMonthAndCity(CategoryReportReq reportReq) {
        List<ReportYearCityResp> hotlineReportResps = bizMayorHotlineMapper.selectReportGroupMonthAndOwnerArea(reportReq);
        return categoryService.getReportMonthAndCity(hotlineReportResps, reportReq);
    }

    /**
     * 热线，月份  分类统计
     */
    public List<ReportYearCategoryResp> getReportGroupByMonthAndCategory(CategoryReportReq reportReq) {
        List<ReportYearCategoryResp> hotlineReportResps = bizMayorHotlineMapper.selectReportGroupMonthAndCategory(reportReq);
        return categoryService.getReportMonthAndCategory(hotlineReportResps, reportReq);
    }

}
